home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vbpxen / custedit.frm < prev    next >
Text File  |  1995-10-23  |  12KB  |  485 lines

  1. VERSION 2.00
  2. Begin Form custedit 
  3.    Caption         =   "Customer View/Edit"
  4.    ClientHeight    =   5130
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1485
  7.    ClientWidth     =   7695
  8.    Height          =   5535
  9.    Left            =   1035
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   5130
  13.    ScaleWidth      =   7695
  14.    Top             =   1140
  15.    Width           =   7815
  16.    Begin CommandButton ButtonDone 
  17.       Caption         =   "E&xIt"
  18.       FontBold        =   -1  'True
  19.       FontItalic      =   0   'False
  20.       FontName        =   "MS Sans Serif"
  21.       FontSize        =   12
  22.       FontStrikethru  =   0   'False
  23.       FontUnderline   =   0   'False
  24.       Height          =   615
  25.       Left            =   6120
  26.       TabIndex        =   19
  27.       Top             =   4200
  28.       Width           =   975
  29.    End
  30.    Begin CommandButton ButtonDelete 
  31.       Caption         =   "&Delete"
  32.       Height          =   615
  33.       Left            =   4440
  34.       TabIndex        =   22
  35.       Top             =   4200
  36.       Visible         =   0   'False
  37.       Width           =   1095
  38.    End
  39.    Begin CommandButton ButtonCancel 
  40.       Caption         =   "&Cancel"
  41.       Height          =   615
  42.       Left            =   1920
  43.       TabIndex        =   21
  44.       Top             =   4200
  45.       Visible         =   0   'False
  46.       Width           =   1095
  47.    End
  48.    Begin CommandButton ButtonOK 
  49.       Caption         =   "&OK"
  50.       Height          =   615
  51.       Left            =   360
  52.       TabIndex        =   20
  53.       Top             =   4200
  54.       Visible         =   0   'False
  55.       Width           =   975
  56.    End
  57.    Begin CommandButton ButtonNew 
  58.       Caption         =   "&Add"
  59.       Height          =   495
  60.       Left            =   6120
  61.       TabIndex        =   18
  62.       Top             =   3240
  63.       Width           =   975
  64.    End
  65.    Begin TextBox Zip 
  66.       Height          =   375
  67.       Left            =   2160
  68.       TabIndex        =   6
  69.       Text            =   " "
  70.       Top             =   2880
  71.       Width           =   1335
  72.    End
  73.    Begin TextBox city 
  74.       Height          =   375
  75.       Left            =   2160
  76.       TabIndex        =   5
  77.       Text            =   " "
  78.       Top             =   2400
  79.       Width           =   3375
  80.    End
  81.    Begin CommandButton ButtonEdit 
  82.       Caption         =   "&Edit"
  83.       Height          =   495
  84.       Left            =   6120
  85.       TabIndex        =   17
  86.       Top             =   2280
  87.       Width           =   975
  88.    End
  89.    Begin TextBox address 
  90.       Height          =   375
  91.       Left            =   2160
  92.       TabIndex        =   4
  93.       Text            =   " "
  94.       Top             =   1920
  95.       Width           =   3375
  96.    End
  97.    Begin CommandButton ButtonLast 
  98.       Caption         =   "&Last"
  99.       Height          =   375
  100.       Left            =   6720
  101.       TabIndex        =   16
  102.       Top             =   1560
  103.       Width           =   735
  104.    End
  105.    Begin CommandButton ButtonFirst 
  106.       Caption         =   "&First"
  107.       Height          =   375
  108.       Left            =   5880
  109.       TabIndex        =   15
  110.       Top             =   1560
  111.       Width           =   735
  112.    End
  113.    Begin TextBox firstname 
  114.       Height          =   375
  115.       Left            =   2160
  116.       TabIndex        =   3
  117.       Text            =   " "
  118.       Top             =   1440
  119.       Width           =   2055
  120.    End
  121.    Begin CommandButton ButtonNext 
  122.       Caption         =   "&Next"
  123.       Height          =   375
  124.       Left            =   6720
  125.       TabIndex        =   14
  126.       Top             =   960
  127.       Width           =   735
  128.    End
  129.    Begin CommandButton ButtonPrior 
  130.       Caption         =   "&Prior"
  131.       Height          =   375
  132.       Left            =   5880
  133.       TabIndex        =   13
  134.       Top             =   960
  135.       Width           =   735
  136.    End
  137.    Begin TextBox lastname 
  138.       Height          =   375
  139.       Left            =   2160
  140.       TabIndex        =   2
  141.       Text            =   " "
  142.       Top             =   960
  143.       Width           =   2055
  144.    End
  145.    Begin TextBox custnumber 
  146.       Height          =   375
  147.       Left            =   2160
  148.       TabIndex        =   1
  149.       Text            =   " "
  150.       Top             =   480
  151.       Width           =   1215
  152.    End
  153.    Begin CommandButton ButtonFind 
  154.       Caption         =   "&Get"
  155.       Height          =   495
  156.       Left            =   6120
  157.       TabIndex        =   11
  158.       Top             =   240
  159.       Width           =   975
  160.    End
  161.    Begin Label total_spent 
  162.       BorderStyle     =   1  'Fixed Single
  163.       Caption         =   " "
  164.       Height          =   375
  165.       Left            =   4440
  166.       TabIndex        =   26
  167.       Top             =   3480
  168.       Width           =   1095
  169.    End
  170.    Begin Label Label8 
  171.       Caption         =   "YTD Spent:"
  172.       Height          =   255
  173.       Left            =   3120
  174.       TabIndex        =   25
  175.       Top             =   3480
  176.       Width           =   1095
  177.    End
  178.    Begin Label tapes_out 
  179.       BorderStyle     =   1  'Fixed Single
  180.       Caption         =   " "
  181.       Height          =   375
  182.       Left            =   2160
  183.       TabIndex        =   24
  184.       Top             =   3480
  185.       Width           =   855
  186.    End
  187.    Begin Label Label7 
  188.       Caption         =   "Tapes out:"
  189.       Height          =   255
  190.       Left            =   720
  191.       TabIndex        =   23
  192.       Top             =   3480
  193.       Width           =   1335
  194.    End
  195.    Begin Label Label6 
  196.       Caption         =   "Zip:"
  197.       Height          =   255
  198.       Left            =   720
  199.       TabIndex        =   10
  200.       Top             =   3000
  201.       Width           =   975
  202.    End
  203.    Begin Label Label5 
  204.       Caption         =   "City:"
  205.       Height          =   375
  206.       Left            =   720
  207.       TabIndex        =   9
  208.       Top             =   2520
  209.       Width           =   1215
  210.    End
  211.    Begin Label Label4 
  212.       Caption         =   "Address:"
  213.       Height          =   255
  214.       Left            =   720
  215.       TabIndex        =   8
  216.       Top             =   2040
  217.       Width           =   1215
  218.    End
  219.    Begin Label Label3 
  220.       Caption         =   "First name:"
  221.       Height          =   255
  222.       Left            =   720
  223.       TabIndex        =   7
  224.       Top             =   1560
  225.       Width           =   1335
  226.    End
  227.    Begin Label Label2 
  228.       Caption         =   "Last name:"
  229.       Height          =   255
  230.       Left            =   720
  231.       TabIndex        =   0
  232.       Top             =   1080
  233.       Width           =   1335
  234.    End
  235.    Begin Label Label1 
  236.       Caption         =   "Number:"
  237.       Height          =   375
  238.       Left            =   720
  239.       TabIndex        =   12
  240.       Top             =   600
  241.       Width           =   975
  242.    End
  243. End
  244. Dim iMode As Integer
  245. Dim blankcustrec As CUST
  246. Dim savecustrec As CUST
  247.  
  248. Const EDIT_MODE = 0
  249. Const ADD_MODE = 1
  250. Const VIEW_MODE = 2
  251.  
  252. Sub ButtonCancel_Click ()
  253.     If iMode = ADD_MODE Then
  254.         custrec = savecustrec
  255.         rc = GetCustomerRec(DBKEYED)
  256.         If rc Then
  257.             rc = GetCustomerRec(DBFIRST)
  258.         End If
  259.     End If
  260.  
  261.     FieldsToForm
  262.     SetEditMode VIEW_MODE
  263. End Sub
  264.  
  265. Sub ButtonDelete_Click ()
  266.     '
  267.     '  check if user pressed OK or CANCEL
  268.     '
  269.     Msg$ = "OK to delete?"
  270.     
  271.     rc = MsgBox(Msg$, MB_OKCANCEL + MB_ICONQUESTION, "DELETE")
  272.     If rc = IDCANCEL Then
  273.         SetEditMode VIEW_MODE
  274.         Exit Sub
  275.     End If
  276.  
  277.     rc = DeleteCustomerRec()
  278.  
  279.     If rc Then
  280.         MsgBox "Delete failed, code: " + Str$(rc)
  281.         Beep
  282.     End If
  283.  
  284.     rc = GetCustomerRec(DBNEXT)
  285.     If rc Then
  286.         rc = GetCustomerRec(DBLAST)
  287.     End If
  288.     
  289.     FieldsToForm
  290.     SetEditMode VIEW_MODE
  291.  
  292. End Sub
  293.  
  294. Sub ButtonDone_Click ()
  295.     Unload custedit
  296. End Sub
  297.  
  298. Sub ButtonEdit_Click ()
  299.     screen.MousePointer = POINTER_HOURGLASS
  300.     rc = GetCustomerRecForUpdate()
  301.     If rc Then
  302.